package com.wisecoach.gatewayplus.spring.seata;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;
import org.aopalliance.intercept.MethodInvocation;

/**
 * {@code @author:} wisecoach
 * {@code @date:} 2023/9/29 下午1:05
 * {@code @version:} 1.0.0
 */
@LocalTCC
public interface TCCLogicExecutor {
    @TwoPhaseBusinessAction(name = "tccTry",
            commitMethod = "tccCommit",
            rollbackMethod = "tccRollback")
    Object tccTry(@BusinessActionContextParameter("invocation") MethodInvocation invocation) throws Throwable;

    void tccCommit(BusinessActionContext context);

    void tccRollback(BusinessActionContext context);

}
